package com.hg.oa.module.calendar.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hg.oa.R;

/**
 * Created by fengxiang on 2016/9/19.
 */
public class CalendarListAdapter extends BaseAdapter{

    String[] strs = new String[]{
            "上午请假半天。"
            ,"HMF 首页界面开发."
            ,"HMF 日历页面列表开发."
    };
    String[] strs2 = new String[]{
            "0.5(天)"
            ,"0.2(天)"
            ,"0.3(天)"
    };
    Context context;

    public CalendarListAdapter(Context context){
        this.context=context;
    }
    @Override
    public int getCount() {
        return 3;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        MyHolder holder;
        if(convertView == null){
            convertView = LayoutInflater.from(context).inflate(R.layout.item_calendar_day_info,null);
            holder = new MyHolder();
            holder.text_index = (TextView) convertView.findViewById(R.id.text_index);
            holder.text_content = (TextView) convertView.findViewById(R.id.text_content);
            holder.text_worktime = (TextView) convertView.findViewById(R.id.text_worktime);
            convertView.setTag(holder);
        }else{
            holder = (MyHolder) convertView.getTag();
        }
        holder.text_index.setText((position+1)+".");
        holder.text_content.setText(strs[position]);
        holder.text_worktime.setText(strs2[position]);
        return convertView;
    }

    class MyHolder{
        TextView text_index;
        TextView text_content;
        TextView text_worktime;
    }
}
